xenpaging: add xs_handle to struct xenpaging
authorOlaf Hering <olaf@aepfle.de>
Wed, 22 Jun 2011 13:47:09 +0000 (14:47 +0100)
committerOlaf Hering <olaf@aepfle.de>
Wed, 22 Jun 2011 13:47:09 +0000 (14:47 +0100)
A xs_handle is currently used in the xc_mem_paging_flush_ioemu_cache()
function and will be used by a subsequent patch.
Add it to struct xenpaging.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/xenpaging/xenpaging.c
tools/xenpaging/xenpaging.h

index d83448f8f5b89a1c614e555eca0c2175d894c5bd..04d362356a13e67e5b5b920552df643b7dd2ade3 100644 (file)
@@ -28,6 +28,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include <xc_private.h>
+#include <xs.h>
 
 #include <xen/mem_event.h>
 
@@ -92,6 +93,14 @@ static xenpaging_t *xenpaging_init(domid_t domain_id)
     paging = malloc(sizeof(xenpaging_t));
     memset(paging, 0, sizeof(xenpaging_t));
 
+    /* Open connection to xenstore */
+    paging->xs_handle = xs_open(0);
+    if ( paging->xs_handle == NULL )
+    {
+        ERROR("Error initialising xenstore connection");
+        goto err;
+    }
+
     p = getenv("XENPAGING_POLICY_MRU_SIZE");
     if ( p && *p )
     {
@@ -221,6 +230,8 @@ static xenpaging_t *xenpaging_init(domid_t domain_id)
  err:
     if ( paging )
     {
+        if ( paging->xs_handle )
+            xs_close(paging->xs_handle);
         xc_interface_close(xch);
         if ( paging->mem_event.shared_page )
         {
@@ -277,6 +288,9 @@ static int xenpaging_teardown(xenpaging_t *paging)
     }
     paging->mem_event.xce_handle = NULL;
     
+    /* Close connection to xenstore */
+    xs_close(paging->xs_handle);
+
     /* Close connection to Xen */
     rc = xc_interface_close(xch);
     if ( rc != 0 )
index 855966772aa13644fae05ec7aac82dfa233ca6f9..2d7bead7a053d4615727d4b4f0b4e1cc08781ed5 100644 (file)
@@ -36,6 +36,7 @@
 
 typedef struct xenpaging {
     xc_interface *xc_handle;
+    struct xs_handle *xs_handle;
 
     xc_platform_info_t *platform_info;
     xc_domaininfo_t    *domain_info;